<template>
  <div class="hFull flex column pra single-select-text-13-questions-body">
    <div class="equal">
      <div class="radioBg">
        <!-- 题目 -->
        <div class="head">
          <div class="flex headBox aicenter jccenter">
            <div class="tips mr10"></div>
            <div class="equal fz16 overflow-y qtText">{{question.guide}}</div>
          </div>
        </div>
        <!-- 问题 -->
        <div class="option">
          <div class="flex otBox aicenter jccenter">
            <div class="equal fzWhite18" v-for="stem in question.stem" :key="stem">{{stem}}</div>
            <div class="equal" v-for="(opt,index) in question.option"
                :key="index"
                @click="selectAnswer(opt)">
              <div class="optionTxt fzWhite18" 
                v-bind:class="{onlink:opt==answer}">{{opt}}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 提交按钮 -->
    <div class="submit pob" @click="submit(answer)"></div>
    <!-- 弹出 -->
    <div class="black none"></div>
    <div class="error none">
      <div class="flex aicenter jccenter errorImg">
        <img src="../assets/images/errorImg.png" alt />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["submitAnswer", "question"],
  data() {
    return {
      answer: null,
    };
  },
  created() {
    console.log(this.question);
  },
  methods: {
    selectAnswer(answer) {
      this.answer = [answer];
    },
    submit(answer) {
      this.answer = null;
      this.submitAnswer(answer);
    },
  },
};
</script>
<style lang="css">
.single-select-text-13-questions-body {
  width: 100%;
  position: relative;
  background: url(../assets/images/pic-03.png) no-repeat center center;
  background-size: 100% 100%;
}
.head {
  position: absolute;
  top: 0.2rem;
  left: 0;
  right: 0;
  padding: 0 0.5rem;
}
.headBox {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 0.1rem;
  border: 0.1rem solid #fff;
}
.tips {
  width: 0.38rem;
  height: 0.33rem;
  display: block;
  background: url(../assets/images/newsIcon.png) no-repeat;
  background-size: 100%;
}
.option {
  width: 44%;
  position: absolute;
  top: 44%;
  left: 28%;
  bottom: 42%;
  right: 28%;
}
.otBox {
  text-align: center;
  background: rgba(60, 112, 92, 0.5);
  border: 0.02rem solid #fff;
  border-radius: 0.05rem;
  padding: 0.05rem 0.05rem;
}
.address {
  position: absolute;
  top: 0%;
  left: 0%;
  bottom: 46%;
  right: 0%;
  padding: 0 0.1rem;
  text-align: center;
  display: flex;
  justify-content: center;
  flex-direction: column;
}
.submit {
  width: 0.98rem;
  height: 0.98rem;
  background: url(../assets/images/submitBtn.png) no-repeat center center;
  background-size: 100% 100%;
  cursor: pointer;
  margin-left: 0.2rem;
}
.qtText {
  height: 0.5rem;
  display: flex;
  justify-content: center;
  flex-direction: column;
}
.optionTxt {
  background-color: #4f8e6f;
  border: 0.02rem dashed #fff;
  border-radius: 100%;
  width: 0.3rem;
  height: 0.3rem;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  flex-direction: column;
}
.optionTxt.onlink {
  background-color: #4da848;
  border: 0.02rem solid #f7d443;
}
.black {
  background: rgba(0, 0, 0, 0.7);
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0px;
  top: 0px;
  bottom: 0;
  right: 0;
  z-index: 4;
}
.error {
  position: fixed;
  width: 60%;
  left: 20%;
  bottom: 20%;
  right: 20%;
  top: 20%;
  z-index: 10;
}
.errorImg {
  width: 100%;
  height: 100%;
}
.errorImg img {
  width: auto;
  max-width: 100%;
}
.pob {
  position: absolute;
  right: 0.2rem;
  bottom: 0.2rem;
}
</style>